Secant Method
   HOME

TheInfoList



OR:

In
numerical analysis Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic computation, symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of ...
, the secant method is a
root-finding algorithm In mathematics and computing, a root-finding algorithm is an algorithm for finding zeros, also called "roots", of continuous functions. A zero of a function , from the real numbers to real numbers or from the complex numbers to the complex numbers ...
that uses a succession of
roots A root is the part of a plant, generally underground, that anchors the plant body, and absorbs and stores water and nutrients. Root or roots may also refer to: Art, entertainment, and media * ''The Root'' (magazine), an online magazine focusing ...
of
secant line Secant is a term in mathematics derived from the Latin ''secare'' ("to cut"). It may refer to: * a secant line, in geometry * the secant variety, in algebraic geometry * secant (trigonometry) (Latin: secans), the multiplicative inverse (or reciproc ...
s to better approximate a root of a
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
''f''. The secant method can be thought of as a finite-difference approximation of
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valu ...
. However, the secant method predates Newton's method by over 3000 years.


The method

For finding a zero of a function , the secant method is defined by the
recurrence relation In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
. : x_n = x_ - f(x_) \frac = \frac. As can be seen from this formula, two initial values and are required. Ideally, they should be chosen close to the desired zero.


Derivation of the method

Starting with initial values and , we construct a line through the points and , as shown in the picture above. In slope–intercept form, the equation of this line is :y = \frac(x - x_1) + f(x_1). The root of this linear function, that is the value of such that is :x = x_1 - f(x_1) \frac. We then use this new value of as and repeat the process, using and instead of and . We continue this process, solving for , , etc., until we reach a sufficiently high level of precision (a sufficiently small difference between and ): : \begin x_2 & = x_1 - f(x_1) \frac, \\ ptx_3 & = x_2 - f(x_2) \frac, \\ pt& \,\,\,\vdots \\ ptx_n & = x_ - f(x_) \frac. \end


Convergence

The iterates x_n of the secant method converge to a root of f is,if the initial values x_0 and x_1 are sufficiently close to the root. The
order of convergence In numerical analysis, the order of convergence and the rate of convergence of a convergent sequence are quantities that represent how quickly the sequence approaches its limit. A sequence (x_n) that converges to x^* is said to have ''order of co ...
is "φ", where :\varphi = \frac \approx 1.618 is the
golden ratio In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Expressed algebraically, for quantities a and b with a > b > 0, where the Greek letter phi ( ...
. In particular, the convergence is super linear, but not quite quadratic. This result only holds under some technical conditions, namely that f be twice continuously differentiable and the root in question be simple (i.e., with multiplicity 1). If the initial values are not close enough to the root, then there is no guarantee that the secant method converges. There is no general definition of "close enough", but the criterion has to do with how "wiggly" the function is on the interval _0, x_1/math>. For example, if f is differentiable on that interval and there is a point where f' = 0 on the interval, then the algorithm may not converge.


Comparison with other root-finding methods

The secant method does not require that the root remain bracketed, like the
bisection method In mathematics, the bisection method is a root-finding method that applies to any continuous function for which one knows two values with opposite signs. The method consists of repeatedly bisecting the interval defined by these values and the ...
does, and hence it does not always converge. The
false position method In mathematics, the ''regula falsi'', method of false position, or false position method is a very old method for solving an equation with one unknown; this method, in modified form, is still in use. In simple terms, the method is the trial and er ...
(or ) uses the same formula as the secant method. However, it does not apply the formula on x_ and x_, like the secant method, but on x_ and on the last iterate x_k such that f(x_k) and f(x_) have a different sign. This means that the
false position method In mathematics, the ''regula falsi'', method of false position, or false position method is a very old method for solving an equation with one unknown; this method, in modified form, is still in use. In simple terms, the method is the trial and er ...
always converges; however, only with a linear order of convergence. Bracketing with a super-linear order of convergence as the secant method can be attained with improvements to the false position method (see Regula falsi § Improvements in ''regula falsi'') such as the ITP method or
Illinois method In mathematics, the ''regula falsi'', method of false position, or false position method is a very old method for solving an equation with one unknown; this method, in modified form, is still in use. In simple terms, the method is the trial and ...
. The recurrence formula of the secant method can be derived from the formula for
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valu ...
:x_n = x_ - \frac by using the finite-difference approximation, for a small \epsilon: f'(x_) \approx \frac \approx The secant method can be interpreted as a method in which the derivative is replaced by an approximation and is thus a
quasi-Newton method Quasi-Newton methods are methods used to either find zeroes or local maxima and minima of functions, as an alternative to Newton's method. They can be used if the Jacobian or Hessian is unavailable or is too expensive to compute at every iteration. ...
. If we compare Newton's method with the secant method, we see that Newton's method converges faster (order 2 against ''φ'' ≈ 1.6). However, Newton's method requires the evaluation of both f and its derivative f' at every step, while the secant method only requires the evaluation of f. Therefore, the secant method may occasionally be faster in practice. For instance, if we assume that evaluating f takes as much time as evaluating its derivative and we neglect all other costs, we can do two steps of the secant method (decreasing the logarithm of the error by a factor ''φ''2 ≈ 2.6) for the same cost as one step of Newton's method (decreasing the logarithm of the error by a factor 2), so the secant method is faster. If, however, we consider parallel processing for the evaluation of the derivative, Newton's method proves its worth, being faster in time, though still spending more steps.


Generalization

Broyden's method In numerical analysis, Broyden's method is a quasi-Newton method for finding roots in variables. It was originally described by C. G. Broyden in 1965. Newton's method for solving uses the Jacobian matrix, , at every iteration. However, compu ...
is a generalization of the secant method to more than one dimension. The following graph shows the function ''f'' in red and the last secant line in bold blue. In the graph, the ''x'' intercept of the secant line seems to be a good approximation of the root of ''f''.


Computational example

Below, the secant method is implemented in the
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
programming language. It is then applied to find a root of the function with initial points x_0 = 10 and x_1 = 30 def secant_method(f, x0, x1, iterations): """Return the root calculated using the secant method.""" for i in range(iterations): x2 = x1 - f(x1) * (x1 - x0) / float(f(x1) - f(x0)) x0, x1 = x1, x2 # Apply a stopping criterion here (see below) return x2 def f_example(x): return x ** 2 - 612 root = secant_method(f_example, 10, 30, 5) print(f"Root: ") # Root: 24.738633748750722 It is very important to have a good stopping criterion above, otherwise, due to limited numerical precision of floating point numbers, the algorithm can return inaccurate results if running for too many iterations. For example, the loop above can stop when one of these is reached first: abs(x0 - x1) < tol, or abs(x0-x1)/abs(x1) < tol, or abs(f(x1)) < tol. https://www.cfm.brown.edu/people/dobrush/am33/Matlab/ch3/secant.html


Notes


See also

*
False position method In mathematics, the ''regula falsi'', method of false position, or false position method is a very old method for solving an equation with one unknown; this method, in modified form, is still in use. In simple terms, the method is the trial and er ...


References

* *


External links


Secant Method
Notes, PPT, Mathcad, Maple, Mathematica, Matlab a
Holistic Numerical Methods Institute
* {{Root-finding algorithms Root-finding algorithms